package br.infotec.musicaunb.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.search.annotations.DocumentId;
import org.springframework.data.jpa.domain.AbstractPersistable;

@Entity
@Table(name = "responsavel")
public class Responsavel extends AbstractPersistable<Long> implements AbstraticPojo{

	/**
	 * @author Denis
	 */
	private static final long serialVersionUID = 1L;

	// Atributos originais
	private String nome;
	private String cpf;
	private String rg;
	private String email;	
	// Atributos relacionais
	private Endereco endereco;
	private List<Acompanhante> acompanhantes;
	private List<Telefone> telefones;
	
	@Override
	@Column(name = "id_responsavel")
	@GeneratedValue
	@DocumentId
	public Long getId() {
		return super.getId();
	}
	
	@Column(name = "nome", length = 45, nullable = false)
	public String getNome() {
		return nome;
	}
	public void setNome(String nome) {
		this.nome = nome;
	}
	
	@Column(name = "cpf", length = 11, nullable = false)
	public String getCpf() {
		return cpf;
	}
	public void setCpf(String cpf) {
		this.cpf = cpf;
	}
	
	@Column(name = "rg", length = 15)
	public String getRg() {
		return rg;
	}
	public void setRg(String rg) {
		this.rg = rg;
	}
	
	@Column(name = "email", length = 45)
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}

	@OneToOne(cascade = CascadeType.ALL)
	public Endereco getEndereco() {
		return endereco;
	}

	public void setEndereco(Endereco endereco) {
		this.endereco = endereco;
	}

	@OneToMany(mappedBy = "responsavel")
	public List<Acompanhante> getAcompanhantes() {
		return acompanhantes;
	}

	public void setAcompanhantes(List<Acompanhante> acompanhantes) {
		this.acompanhantes = acompanhantes;
	}
	
	@OneToMany(mappedBy = "responsavel")
	public List<Telefone> getTelefones() {
		return telefones;
	}

	public void setTelefones(List<Telefone> telefones) {
		this.telefones = telefones;
	}
	
	
}
